package com.cyj.dream.admin.model.system;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.cyj.dream.core.base.SysBaseEntity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;

/**
 * @Description: 系统操作日志记录
 * @BelongsProject: dream-DreamChardonnay
 * @BelongsPackage: com.dream.DreamChardonnay.model.system
 * @Author: ChenYongJia
 * @CreateTime: 2021-04-02 09:43
 * @Email: chen87647213@163.com
 * @Version: 1.0
 */

@Data
@ToString
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "dream_sys_operation_log")
@TableName("dream_sys_operation_log")
@ApiModel(value = "系统操作日志记录", description = "dream_sys_operation_log 系统操作日志记录")
public class SysOperationLog extends SysBaseEntity implements Serializable {

    @ApiModelProperty(value = "操作者(存入操作用户的userId)", example = "1")
    @Column(columnDefinition = "bigint(20) COMMENT '操作者(存入操作用户的userId)'")
    private Long logOperatorUserId;

    @ApiModelProperty(value = "操作者Ip")
    @Column(columnDefinition = "varchar(255) COMMENT '操作者Ip'")
    private String logOperatorIp;

    @ApiModelProperty(value = "操作者用于访问的系统")
    @Column(columnDefinition = "varchar(255) COMMENT '操作者用于访问的系统'")
    private String logOperatorSystem;

    @ApiModelProperty(value = "操作者用于访问的浏览器名称")
    @Column(columnDefinition = "varchar(255) COMMENT '操作者用于访问的浏览器名称'")
    private String logOperatorBrowser;

    @ApiModelProperty(value = "操作者用于访问的浏览器版本")
    @Column(columnDefinition = "varchar(100) COMMENT '操作者用于访问的浏览器版本'")
    private String logOperatorBrowserVersion;

    @ApiModelProperty(value = "操作的类名称")
    @Column(columnDefinition = "varchar(140) COMMENT '操作的类名称'")
    private String logOperatorClassName;

    @ApiModelProperty(value = "操作的方法名称(存入控制器方法名称RequestMapping内的value保持一致)")
    @Column(columnDefinition = "varchar(500) COMMENT '操作的方法名称(存入控制器方法名称RequestMapping内的value保持一致)'")
    private String logOperatorMethodName;

    @ApiModelProperty(value = "操作的控制器路径")
    @Column(columnDefinition = "varchar(255) COMMENT '操作的控制器路径'")
    private String logOperatorPath;

    @ApiModelProperty(value = "操作的请求类型")
    @Column(columnDefinition = "varchar(20) COMMENT '操作的请求类型'")
    private String logOperatorRequestType;

    @ApiModelProperty(value = "操作内容(存入控制器方法名称RequestMapping内的name保持一致)")
    @Column(columnDefinition = "varchar(500) COMMENT '操作内容(存入控制器方法名称RequestMapping内的name保持一致)'")
    private String logOperatorContent;

    @ApiModelProperty(value = "操作内容(存入控制器方法名称RequestMapping内的name保持一致)")
    @Column(columnDefinition = "varchar(500) COMMENT '操作内容(存入控制器方法名称RequestMapping内的name保持一致)'")
    private String logOperatorType;

    @ApiModelProperty(value = "操作结果(操作的执行状态:200,404这一类的)")
    @Column(columnDefinition = "varchar(20) COMMENT '操作结果(操作的执行状态:200,404这一类的)'")
    private String logOperatorResults;

    @ApiModelProperty(value = "操作者所在国家")
    @Column(columnDefinition = "varchar(100) COMMENT '操作者所在国家'")
    private String logOperatorNation;

    @ApiModelProperty(value = "操作者所在省")
    @Column(columnDefinition = "varchar(100) COMMENT '操作者所在省'")
    private String logOperatorProvince;

    @ApiModelProperty(value = "操作者所在市")
    @Column(columnDefinition = "varchar(100) COMMENT '操作者所在市'")
    private String logOperatorCity;

    @ApiModelProperty(value = "操作者所在区")
    @Column(columnDefinition = "varchar(100) COMMENT '操作者所在区'")
    private String logOperatorArea;

    /**
     * 用户名称
     */
    @Transient
    @ApiModelProperty(value = "用户名称")
    @TableField(exist = false)
    private String sysUserName;

}
